<?
foreach($arResult["ITEMS"] as $k => $item):
    if(count($item["OFFERS"])):
       $arResult["ITEMS"][$k]["OFFERS_BOOL"]=true;      
       $maxval=0;
       $minval=20000000; 
       foreach($item["OFFERS"] as $offersitem):
           if($maxval<$offersitem["CATALOG_PRICE_1"]){$maxval=$offersitem["CATALOG_PRICE_1"];$maxoffers=$offersitem;}
           if($minval>$offersitem["CATALOG_PRICE_1"]){$minval=$offersitem["CATALOG_PRICE_1"];$minoffers=$offersitem;}              
       endforeach;
       $arResult["ITEMS"][$k]["MAXVALUE"]=$maxval;
       $arResult["ITEMS"][$k]["MINVALUE"]=$minval; 
       $arResult["ITEMS"][$k]["MAXOFFERS"]=$maxoffers;
       $arResult["ITEMS"][$k]["MINOFFERS"]=$minoffers; 
    endif; 
    
    $arResult["ITEMS"][$k]["PHOTO_SMALL"] = $APPLICATION->IncludeComponent("soulstream:imager", "", Array(
										"MODE" => "4",
										"RETURN" => "src",
										"IMAGE" => $item["PREVIEW_PICTURE"]["SRC"],
										"WIDTH" => "45",
										"HEIGHT" => "56",
										"ADD_WATERMARK" => "N"										
										),false, array("HIDE_ICONS"=>"Y")
					);
endforeach;

$lcur = CCurrency::GetList(($b="name"), ($order1="asc"), LANGUAGE_ID);
$URLcon="";
while($lcur_res = $lcur->Fetch())
    { 
        $URLcurrency.='<a href="?SETCURRENCY='.$lcur_res["CURRENCY"].'"> '.$lcur_res["CURRENCY"].' </a>';  
    }; 
$arResult["CurrencyURL"]=$URLcurrency;
if(!empty($_REQUEST["SETCURRENCY"]))$_SESSION["USER_SHOW_CIURRENCY"]=$_REQUEST["SETCURRENCY"];
if(empty($_SESSION["USER_SHOW_CIURRENCY"]))$_SESSION["USER_SHOW_CIURRENCY"]=CCurrency::GetBaseCurrency();
//echo $_SESSION["USER_SHOW_CIURRENCY"]." ".$arResult["CurrencyURL"];


?>